﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography;

namespace PMSWenLvTing.Utility
{
    /// <summary>
    /// MD5加密类
    /// </summary>
    public class MD5Cryptography
    {
        /// <summary>
        /// MD5加密方法
        /// </summary>
        /// <param name="theStr">加密目标字符串</param>
        /// <returns></returns>
        public string EncryptString(string theStr)
        {
            string myWord = "@taiyangcheng2020yuding";
            MD5 md5 = MD5.Create();
            byte[] buffer = Encoding.Default.GetBytes(theStr+myWord);
            byte[] res = md5.ComputeHash(buffer);
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < res.Length; i++)
            {
                sb.Append(res[i].ToString("x2"));
            }
            string str = sb.ToString();
            return str;
        }


    }
}
